package firstcontent.gc;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: fxy
 * @Date: 2022/02/24/8:09
 * @Description: -Xms8m -Xmx8m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=D:\
 * -XX:+PrintGCDetails -Xloggc:D:\gc.log
 *
 * GC easy分析日志
 */
public class HeapOOM {
    /**
     * 1m
     */
    byte[] buffer = new byte[1*1024*1024];

    public static void main(String[] args) {
        List<HeapOOM> list = new ArrayList<>();
        int count = 0;
        try{
            while(true){
                list.add(new HeapOOM());
                count++;
            }
        }catch (Throwable e){
            System.out.println("count = "+count);
            e.printStackTrace();
        }
    }
}
